# id
#element.find_elements 返回一个列表
# By.ID   By.CLASS_NAME   By.TAG_NAME
# wd.webdriver()  返回一个WebDiver对象
#  wd.webdriver().find_elements(By.ID,'xxx')返回一个webElement对象
# webDiver.find_elements
# webElement.find_elements
# wd.implicitly_wait()



from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
import time

wd = webdriver.Chrome(service=Service(r'/Users/show/Downloads/编程/python学习/chromedriver-mac-arm64/chromedriver'))
wd.get('https://www.byhy.net/cdn2/files/selenium/stock1.html')

element = wd.find_element(By.ID,'kw')

element.send_keys('你好')

element = wd.find_element(By.ID,'1')
print(element.text)

time.sleep(2)



wd.get("https://www.byhy.net/cdn2/files/selenium/sample1.html")
elements = wd.find_elements(By.CLASS_NAME,'animal')
for i in elements:
    print(i.text)

elements2 = wd.find_elements(By.TAG_NAME,'div')
for i in elements2:
    print(i.text)

